<template>
  <div class="article-item">
    <van-cell
      :title="article.title"
      :to="`/article/${article.art_id}`"
    >
      <div
        slot="label"
        class="custom-label"
      >
        <div
          class="cover-images"
          v-if="article.cover.type===3"
        >
          <van-image
            v-for="(item,index) in article.cover.images"
            :key="index"
            fit="cover"
            :src="item"
          />
        </div>
        <span>{{article.aut_name}}</span>
        <span class="common">{{article.comm_count}}评论</span>
        <span>{{article.pubdate | dateFormat}}</span>
      </div>
      <!-- 自定义右侧内容 -->
      <van-image
        v-if="article.cover.type===1"
        class="right-img"
        fit="contain"
        :src="article.cover.images[0]"
      />
    </van-cell>
  </div>
</template>

<script>
export default {
  props: {
    // 父组件传递的文章列表项数据
    article: {
      type: Object,
      required: true

    }
  },
  data () {
    return {}
  },
  methods: {},
  computed: {},
  watch: {},
  filters: {},
  components: {},
  created () { },
  mounted () { }
}
</script>

<style scoped lang='less'>
.article-item {
  .van-cell__value {
    flex: unset;
  }

  .custom-label {
    font-size: 23px;
    color: #999;
    span {
      display: inline-block;
      margin: 24px 0;
    }
    // 第二个span的样式
    .common {
      margin-left: 10px;
      margin-right: 10px;
    }
    // 三张图片封面
    .cover-images {
      // 开启flex布局在一行显示
      display: flex;
      margin: 20px 0;
      .van-image {
        width: 232px;
        height: 146px;
      }
      .van-image:nth-child(2) {
        margin: 0 3px;
      }
    }
  }
  // 自定义右侧内容
  .right-img {
    width: 232px;
    height: 146px;
  }
}
</style>
